<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="toTop" content="true">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" href="./Public/Home/css/gwc.css" />
<script type="text/javascript">
	var total = "<?php echo $_SESSION['cart']['total']?>";
	var allnum = "<?php echo $_SESSION['cart']['total_rows']?>";
</script>
<!--头部公用部分载入-->
<script type="text/javascript" src="./Public/Home/js/jquery-1.8.2.min.js"></script>
<!--<script type="text/javascript" src="./Public/Home/js/jquery.1.7.2-min.js"></script>-->
<script type="text/javascript" src="./Public/Home/js/js.js"></script>

</head>
<body>
	
	<!-- 顶部开始 -->
<div id="top">
   <div class="topall">
       <a class="topallleft1" href="http://127.0.0.1/project/index.php?m=Home&c=Index&a=index">商城首页</a>
       <a class="topallleft2" href="">玩货</a>
                       
       <span class='topallleft3'>
       <a href="http://127.0.0.1/project/index.php?m=Home&c=Login&a=index" class="login">登录</a>
       <a href="http://127.0.0.1/project/index.php?m=Home&c=Reg&a=index" class="reg">注册</a>  
       </span>
              <span class='link'>|</span>
       <span class='topallleft3'>
       <a href="http://127.0.0.1/project/index.php?m=Home&c=Orderlist&a=index" class="reg">我的订单</a>     
       </span>
       <span class='link'>|</span>
       <span class='topallleft3'>
       <a href="" class="reg">我的卖家</a>     
       </span>
       <span class='link'>|</span>
       <span class='topallleft3'>
       <a href="" class="reg">帮助中心</a>     
       </span>
       <span class='link'>|</span>
       <span class='topallleft4'>客服电话 400-810-0580</span>
   </div>	
</div>
<!-- 顶部结束 -->
<!-- 搜索区域开始 -->
<div id="search">
   <div class="searchleft">
   	  <a href=""class="searchlogo"></a>
   <div class="searchka">
  	 <form name="" action="" target="">
  	   <div class="searchkatext">
  	     <input name="" value="" type="text">
  	   </div>
  	   <div class="searchkasubmit">
  	     <input value="搜&nbsp;&nbsp;&nbsp;索" type="submit">
  	   </div>
  	   </form>
  	   <ul class="searchgjz">
	  	   <li><a href="">GoPro</a></li>
	  	   <li><a href="">大疆</a></li>
	  	   <li><a href="">PHILIPS电动牙刷</a></li>
	  	   <li><a href="">演唱会门票</a></li>
	  	   <li><a href="">20元海淘券</a></li>
  	   </ul>
  	   
   </div>
            <a href="http://127.0.0.1/project/index.php?m=Home&c=Cart&a=index&cmid=0" class="searchgwc"><i><em id='gwc' style="overflow: hidden;">1</em></i>购物车</a>
       
                  </div>
</div>
<!-- 搜索区域结束 -->

<!-- 导航分类开始 -->
<div id="nav">
	<div class="navall">
		<ul>
			<li><a href="index.php"  >首页</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=1" >影视周边</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=2" >数码IT</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=3" >图书用品</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=4" >个人美妆</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=5" >服饰配件</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=6" >小家电</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=7" >票务演出</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=8" >食品</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=9" >日用百货</a></li>
						<li><a href="http://127.0.0.1/project/index.php?m=Home&c=Cata&a=index&cid=10" >其他</a></li>
					</ul>
	</div>
</div>
<!-- 导航分类结束 -->

<script type="text/javascript">
				$(function(){
				//加事件
				$('.jia').click(function(){
					var x=$(this).index('.jia');
					//用class点击获得
					var num=$(this).next('[name=num]').val();
					num=parseInt(num)+1;
		            $(this).next('[name=num]').val(num);
					var sid=$(this).siblings('[name=sid]').val();
//					alert(sid);
					//发送异步
					$.ajax({
						type:"post",
//						请求地址
						url:"<?php echo U('Cart/edit',array('cmid'=>$_GET['cmid']))?>",
						data:{
							sid:sid,
							num:num
						},
						dataType:'json',
						success:function(data){
                            var jiage=$('[name=jiage]').eq(x).val();
							var price=num*jiage;
							$('.top-up').eq(x).find('.price').html(price);
						}
					});
				})
			})
		</script>
</script>
<script type="text/javascript">
				$(function(){
				//减事件
				$('.jian').click(function(){
					var x=$(this).index('.jian');
					//用class点击获得
					var num=$(this).siblings('[name=num]').val();
					if(num>1){
					  num=parseInt(num)-1;
					}
//                  if(num==1){$('.jian').unbind("click");}
		            $(this).siblings('[name=num]').val(num);
					var sid=$(this).siblings('[name=sid]').val();
//					alert(num);
					//发送异步
					$.ajax({
						type:"post",
//						请求地址
						url:"<?php echo U('Cart/edit',array('cmid'=>$_GET['cmid']))?>",
						data:{
							sid:sid,
							num:num
						},
						dataType:'json',
						success:function(data){
//							获得隐藏域的价格
							var jiage=$('[name=jiage]').eq(x).val();
//							获得jian之后价格
							var price=num*jiage;
//							抓取当前第x的价格付一个新价格
							$('.top-up').eq(x).find('.price').html(price);
						}
					});
				})
			})
		</script>
</script>
<!--内容区域开始-->
<div id="content-title">
	<h1>我的购物车</h1>
</div>
<div id="content-all">
	<span>全部商品（0）</span>
</div>
<?php if(empty($data['goods'])){?>
                
<div id="kkry">
	<a href="<?php echo U('Index/index')?>"><img src="./Public/Home/img/ggwc.png"/></a>
</div>
<?php }else{?>
<form action="" method="post">
<table id="table">
   <thead>
   	<tr>
   		<th class="qx">
   			<input class="checkboxall" type="checkbox"/>&nbsp;&nbsp;全选
   		</th>
   		<th class="info">
   			商品信息
   		</th>
   		<th class="pr">
   			单价（元）
   		</th>
   		<th class="co">
   			数量
   		</th>
   		<th class="am">
   			小计（元）
   		</th>
   		<th class="op">
   			操作
   		</th>
   	</tr>
   	<?php foreach ($data['goods'] as $k=>$v){?>
   	<tbody>
   		<tr class="top">
   		</tr>
   		<tr class="top-up">
   			<td class="up-1">
   				<input type="checkbox" name="shop" class="shop"  value="" />
   			</td>
   			<td class="up-2">
                <a href=""><img src="<?php echo $v['photo']?>"/></a>
   			</td>
   			<td class="up-3">
                <a href=""><?php echo $v['name']?></a>
                <?php foreach ($v['options'] as $kk=>$vv){?>
                <p><span><?php echo $kk?>：<?php echo $vv?></span></p>
                <?php }?>
   			</td>
   			<td class="up-4">
                <span><?php echo $v['price']?></span>
   			</td>
   			<td class="up-5">
   				<div>
   					<input type="hidden" name="sid"  value="<?php echo $k?>" />
   					<input type="hidden" name="jiage" value="<?php echo $v['price']?>" />
   					<span class="jia">+</span>
   					<input type="text" value="<?php echo $v['num']?>" class="allnum" name="num" />
   					<span class="jian">-</span>
   				</div>
   			</td>
   			<td class="up-6">
                <span class="price"><?php echo $v['price']*$v['num']?></span>
   			</td>
   			<td class="up-7">
                <a href="<?php echo U('del',array('id'=>$k))?>">删除</a>
   			</td>
   		</tr>
   	</tbody>
   	<?php }?>
   </thead>
</table>

<div id="settle">
	<span class="settle-1">
		 <input type="checkbox" class="checkboxall" value="" />&nbsp;&nbsp;全选
		 <a href="javascript:;">删除选中商品</a> 
		 <a href="javascript:;">删除失效商品</a>
	</span>
	
	<div class="yxsp jiesuan">
		<div class="jsss">
			<a href="javascript:;" id="jiesuan" style="text-decoration: none;  color: #FFFFFF;">结&nbsp;&nbsp;算</a>
		</div>	
	</div>
	<div class="yxsp allprice">
		合计（不含运费）：<span>￥0</span>
	</div>
	<div class="yxsp allyxsp">
		已选商品：<span>&nbsp;&nbsp;0&nbsp;&nbsp;</span>件
	</div>
</div>
<!--内容区域结束-->
</form>
<script type="text/javascript">
	$('#jiesuan').click(function(){
//		$('form').submit();
//      获得跳转到订单页页面地址
		var dizhi="<?php echo U('Order/index')?>";
		var sid='';
//		循环判断复选框是否选择抓隐藏$k值
		$.each($('.shop:checked'),function(){
			sid+=$(this).parents('tbody').find('[name=sid]').val()+',';
		})
//		判断是否选择商品，选中提交
	    if(sid){
	    	$(this).attr('href',dizhi+'&sids='+sid);
	    }
	})
</script>

               <?php }?>
<div style="clear: both;"></div>
<!--调用尾部公用-->
<!--尾部区域开始-->
<div id="footer">
	<div class="footertop">
		<div class="footertop1"></div>
		<hr />
		<div class="footertop2">
			<p>
				商家入驻：
				<a href="http://www.tudou.com">mall@tudou.com</a>
			</p>
			
			
		</div>
		<div class="footertop2 top3">
			<p>
				Copyright©2015 优酷 youku.com 版权所有 京ICP证060288号 | 
				<a href="http://www.youku.com">优酷商城用户服务协议</a>
			</p>
	</div>	
</div>
<!--尾部区域结束-->
</body>
</html>
